<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <!-- 引入本地jquery函数库 -->
    <script type="text/javascript" src="js/jquery-2.0.3.min.js"></script>
    <script type="text/javascript">
        $(function (){
            var obj = localStorage.getItem("userInfo");
            // 判断对象
            if(obj == null){//表示未登录
                 window.location.href = "/login.html";
            }else{
                // 将json字符串对象转换为普通js对象
                userInfo = JSON.parse(obj);
                $("#showAaccount").text(userInfo.account);
            }
            // 退出按钮绑定点击事件
            $("#logout").click(function (){
                 // 清空localStorage对象
                 localStorage.clear();
                 window.location.href = "/login.html";
            })

        })
    </script>
</head>
<body>
<h1><span id="showAaccount"></span>欢迎您！<a href="javascript:void(0);" id="logout">退出</a></h1>
</body>
</html>